package java33;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Person[] p = new Person[n];
		for (int i = 0; i < n; i++) {
			String a = sc.next();
			int b = sc.nextInt();
			boolean c = sc.nextBoolean();
			p[i] = new Person(a, b, c);
		}
		for (int i = p.length- 1; i >= 0; i--) {
			System.out.println(p[i]);
		}
		Person t = new Person();
		System.out.println(t);
		sc.close();
	}
}
